package com.hy.study.mapper;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * key value的文件解析方式 统计Key的次数
 *
 * @author huyong
 * @date 2024 年 01 月 31 日 9:41: 58
 */
public class KeyValueMapper extends Mapper<Text, Text, Text, IntWritable> {
    private IntWritable v = new IntWritable(1);

    @Override
    protected void map(Text key, Text value, Mapper<Text, Text, Text, IntWritable>.Context context) throws IOException, InterruptedException {
        context.write(key, v);
    }
}
